package com.stx.hotkey.client.callback;

import com.google.common.eventbus.Subscribe;
import com.stx.hotkey.common.model.HotKeyModel;

/**
 * 监听有新key推送事件
 */
public class ReceiveNewKeySubscribe {

    private ReceiveNewKeyListener receiveNewKeyListener = new DefaultNewKeyListener();

    @Subscribe
    public void newKeyComing(ReceiveNewKeyEvent event) {
        HotKeyModel hotKeyModel = event.getModel();
        if (hotKeyModel == null) {
            return;
        }
        // 收到新key的推送
        if (receiveNewKeyListener != null) {
            receiveNewKeyListener.newKey(hotKeyModel);
        }
    }
}
